/*
 * 文件名: HomePageTipDialog.java
 * 版    权：  Copyright PingAn Technology All Rights Reserved.
 * 描    述: [该类的简要描述]
 * 创建人: EX-XUJIAO001
 * 创建时间: 2011-12-31
 * 
 * 修改人：
 * 修改时间:
 * 修改内容：[修改内容]
 */
package app.widget.dialog;


import android.content.Context;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import app.widget.BaseDialog;

import com.longevityassistant.activity.R;

/**
 * @author EX-XUJIAO001
 * @date 2011-12-31
 * @version [Android PABank C01, @2011-12-31]
 * @description 主页温馨提示Dialog
 */
public class HomePageTipDialog extends BaseDialog{
	/**
	 * 上下文
	 */
	private Context context;
	/**
	 * listView
	 */
	private ListView listView;
	
	/**
	 * 验证信息
	 */
	private TextView mVerInfo;
	/**
	 * 登录信息
	 */
	private TextView mLoginInfo;
	/**
	 * 关闭
	 */
	private Button close;
	/**
	 * 用户名
	 */
	private String userName;
	/**
	 * 用户最后登录时间
	 */
	private String lastLoginTime;
	/**
	 * 用户验证信息
	 */
	private String verInfo;
	/**
	 * 返回view
	 */
	private View contentView;
	/**
	 * 马上设置
	 */
	private Button btnNowSetting;
	
	/**
	 * 
	 * [构造简要说明]
	 * @param context 上下文
	 */
	public HomePageTipDialog(Context context,String userName,String lastLoinTime,String verInfo) {
		super(context);
		this.context = context;
		this.userName = userName;
		this.verInfo = verInfo;
		this.lastLoginTime = lastLoinTime;
		
		initView();
	}
	/**
	 * 
	 * [一句话功能简述]<BR>
	 * [功能详细描述] 初始化
	 */
	private void initView() {
		setTitle(R.string.welcome_info);
		
		contentView = LayoutInflater.from(context).inflate(R.layout.app_widget_dialog_home_page_tip, null);
		
		mVerInfo = (TextView)contentView.findViewById(R.id.ver_info);
		mLoginInfo = (TextView)contentView.findViewById(R.id.login_info);
		btnNowSetting = (Button)contentView.findViewById(R.id.now_setting);
		if(verInfo==null||"".equals(verInfo)){
			btnNowSetting.setVisibility(View.VISIBLE);
		}else{
			btnNowSetting.setVisibility(View.GONE);
		}
		btnNowSetting.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
//				context.startActivity(new Intent(context,PreviousMessageSetActivity.class));
				HomePageTipDialog.this.dismiss();
				
			}
		});
		mVerInfo.setText(context.getString(R.string.ver_info)+verInfo);
		
		mLoginInfo.setText(context.getString(R.string.hello)+userName+context.getString(R.string.welcome_info_tip)+lastLoginTime);
		mLoginInfo.setMovementMethod(ScrollingMovementMethod.getInstance());
		setBtn1ClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				HomePageTipDialog.this.dismiss();
			}
		});
		setBtn2Visible(false);
	}

	@Override
	public View createContentView() {
		// TODO Auto-generated method stub
		return contentView;
	}

	
}

